-- Project: collision test
-- Description:
--
-- Version: 1.0
-- Managed with http://CoronaProjectManager.com
--
-- Copyright 2012 . All Rights Reserved.
---- cpmgen main.lua

local physics = require("physics")
physics.start()

display.setStatusBar(display.HiddenStatusBar)
local balls = {}local bg1 = display.newImage("bg2.png")local ball1 = display.newImage("ball1.png")local ball2 = display.newImage("ball1.png")local grassData = (require "bg2").physicsData(1.0)local ballData = (require "ball").physicsData(1.0)local ball2Data = (require "ball2").physicsData(1.0)ball2.x = 100physics.addBody ( bg1, "static",  grassData:get("bg2"))physics.addBody ( ball1, ballData:get("ball1"))physics.addBody ( ball2, ball2Data:get("ball1"))local moveTimer local held = falselocal xDistlocal yDistlocal function moveBall()	if held == true then		ball1:applyForce(xDist, yDist, ball1.x, ball1.y) 		moveTimer = timer.performWithDelay ( 0, moveBall  )	endendlocal onTouch = function(event)		if event.phase == "began" then		held = true			xDist = (event.x - ball1.x) * -.01		yDist = (event.y - ball1.y) * -.01		moveBall()		elseif event.phase == "ended" then		held = false	end
endRuntime:addEventListener( "touch", onTouch)